Carbon


SectRect

Header: Quickdraw.h Carbon status: Supported

Determines whether two rectangles intersect.

Boolean SectRect (
    const Rect *src1, 
    const Rect *src2, 
    Rect *dstRect
);
Parameter descriptions
src1

The first of two rectangles to test for intersection.

src2

The second of two rectangles to test for intersection.

dstRect

On return, a pointer to the rectangle marking the intersection of the first two rectangles.

function result

TRUE if the specified rectangles intersect or FALSE if they do not.

DISCUSSION

The SectRect function calculates the rectangle that delineates the intersection of the two rectangles you specify in the src1 and src2 parameters. Rectangles that touch at a line or a point are not considered intersecting, because their intersection rectangle (actually, in this case, an intersection line or point) does not enclose any pixels in the bit image.

If the rectangles do not intersect, the destination rectangle is set to (0,0,0,0). The SectRect function works correctly even if one of the source rectangles is also the destination.

If the points or rectangles supplied to this function are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the SetPort function to change to the graphics port containing the points or rectangles, using the LocalGlobal function to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal function to convert the locations of points or rectangles to the local coordinates of your current graphics port.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)